package com.shen.test;

import java.util.InputMismatchException;
import java.util.Scanner;

/**
 * Author:shen
 * CreateDate:2020/5/18.
 * Function:
 */
public class MyTest02 {
    static Scanner scanner=new Scanner(System.in);
    public static void main(String[] args) {
        int avg;
        try {
            System.out.println("请输入总课时：");
            int total=scanner.nextInt();
            System.out.println("请输入课程数：");
            int num=scanner.nextInt();
             avg=total/num;
             if(avg<100){
                 throw new Exception("课时太少");
             }
            System.out.println("平均每门课的课时"+avg+"节");
        } catch (InputMismatchException e) {
            System.out.println("请输入数字！");
        }catch (ArithmeticException e){
            System.out.println("算数错误！");
        } catch (Exception e) {
            System.out.println(e.getMessage());
        } finally {
            System.out.println("结束");
        }

    }
}
